/**
 * @Author 安广伟
 * @Date 2024/7/16 13:22
 * @LastEditTime 2024-07-16 13:22:06
 * @Version 1.0
 * @Description:
 */

package com.example.demo.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {
    public final static String INSURANCE_QUEUE = "insurance.queue";
    public final static String INSURANCE_EXCHANGE = "insurance.exchange";
    public final static String INSURANCE_ROUTING_KEY = "insurance.routing.key";

    // 添加消息转换器，否则消费者消费是会无法转换消息
    @Bean
    public MessageConverter messageConverter(){
        return new Jackson2JsonMessageConverter();
    }

}
